perm filename FREE[J17,SYS] blob sn#064381 filedate 1973-10-01 generic text, type T, neo UTF8
COMMENT ⊗   VALID 00002 PAGES 
RECORD PAGE   DESCRIPTION
 00001 00001
 00002 00002	TITLE FREE
 00011 ENDMK
⊗;
TITLE FREE
OPDEF PEEK [CALLI 33]
OPDEF SETPR2 [CALLI 400052]
P←17

LOC 124
JRST REE
RELOC
REE:	SETOM	ALL#
	CAIA
STRT:	SETZM	ALL
STRTA:	CALLI
	SETZM	INUSE
	SETZM	NINUSE
	SETZM	DIST
	SETZM	NFREE#
	SETZM	NUSE#
	MOVE	1,[DIST,,DIST+1]
	BLT	1,DIST+177
	MOVEI	P,PDL
	MOVEI	1,37
	PEEK	1,
	MOVEM 1,MEMSIZ#
	HRLZS 1
	TLZ 1,401776
	CALL 1,['SETPR2']
	JRST	NOSETP
	SETZM INUSE#
	SETZM NINUSE#
	INIT 0,0
	'LPT   '
	XWD HEAD,0
	JRST	NOLPT
	SETZM NAME+3
	SETZM NAME+2
	HLLZS NAME+1
	ENTER NAME
	JRST [	OUTSTR[ASCIZ/ENTER FAILED!
/]
		HALT STRTA]
	OUTBUF 0,2
	MOVE 6,[POINT 7,[ASCIZ/LOC	IN USE	FREE

/]]
	SKIPN ALL
	PUSHJ P,PUTSTR
	MOVE 16,400263			;GET ADDRESS OF MEMSIZ
	MOVE 16,400000(16)		;GET MEMSIZ
	MOVE 1,[400000(16)]
	MOVEM 1,SYSLOC#
	MOVE 1,MEMSIZ
	CAIG 1,377777
	JRST LOOP
	CAIE 1,777777
	JRST [	OUTSTR[ASCIZ/CAN'T MAP TO IT!
/]
		HALT STRT]
	MOVE 1,[376001,,400000]
	SETPR2 	1,
	JRST	NOSET
	MOVNI 1,400000(1)
	HRRM 1,SYSLOC
LOOP:	SKIPE ALL
	JRST NOLOC
	HRRZ 2,16
	PUSHJ P,OCTPNT
	MOVEI 7,11
	PUSHJ P,PUTOUT
NOLOC:	MOVEM 16,LAST#
	HRRZ 16,@SYSLOC
	CAMLE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IMED
/]]
	PUSHJ P,PUTSTR
	MOVEI	16,264
	PEEK	16,
	MOVSI	15,-17
	MOVE	6,[POINT 7,[ASCIZ/


REQUEST POPULATIONS:
SIZE	COUNT
/]]
	PUSHJ	P,PUTSTR
RPQLOP:	MOVE	2,16
	ADDI	2,(15)
	PEEK	2,
	JUMPE	2,RPQSKP
	PUSH	P,2
	MOVEI	2,1(15)
	LSH	2,3
	PUSHJ	P,OCTPNT		;PRINT OCTAL.
	MOVEI	7,11
	PUSHJ	P,PUTOUT
	POP	P,2
	PUSHJ	P,OCTPNT
	MOVE	6,[POINT 7,[ASCIZ/
/]]
	PUSHJ	P,PUTSTR
RPQSKP:	AOBJN	15,RPQLOP
	CALLI 12


NAMTAB:	[ASCIZ/		JOB READ OR WRTINF/]		;0-6
	[ASCIZ/		DATA DISK QUEUE BLOCK/]		;7-16
	[ASCIZ/		RUN UUO OR JBTJL/]		;17-26
	[ASCIZ/		IMP DDB/]			;27-36
	[ASCIZ/		WHO LINE OR MAIL/]		;37-46
	[ASCIZ/		IMP MESSAGE BLOCK/]		;47-56
	[ASCIZ/		PAGE PRINTER BLOCK/]		;57-66
	0						;67-76
	[ASCIZ/		JBTDTS OR DSK DDB/]		;77-106
	0						;107-116
	[ASCIZ/		TTY DDBS & LINE POINTER TABLE/]	;117-126
	[ASCIZ/		JBTPDL/]			;127-136
	[ASCIZ/		DISPLAY HEADER OR BLK TBL FOR DPYOUT/]	;137-146
	0						;147-156
	0						;157-166
	0						;167-176
	[ASCIZ/		APRLST - TIMED USER INTERRUPT LIST/]	;177-206
NAMLEN←←.-NAMTAB

DPT:	PUSHJ P,DP1
	MOVEI 7,"."
	JRST PUTOUT

DP1:	SKIPA 3,[=10]
OCTPNT:	MOVEI 3,10
	HRRM 3,OCTPN1
OCTPN1:	IDIVI 2,10
	HRLM 3,(P)
	JUMPE 2,.+2
	PUSHJ P,OCTPN1
OCTOUT:	HLRZ 7,(P)
	ADDI 7,60
	PUSHJ P,PUTOUT
	POPJ P,
PUTOUT:	SOSG HEAD+2
	OUT
	CAIA
	HALT STRTA
	IDPB 7,HEAD+1
CPOPJ:	POPJ P,

PUTSTR:	ILDB 7,6
	JUMPE 7,CPOPJ
	PUSHJ P,PUTOUT
	JRST PUTSTR
LIT↔VAR
NAME:	'FREE  '
	'LST   '
	0
	0
HEAD:	BLOCK 3
PDL:	BLOCK 10
DIST:	BLOCK 200
NOSETP:
NOSET:	OUTSTR	[ASCIZ/SETPR2 FAILURE
/]
	CALLI	12
NOLPT:	OUTSTR	[ASCIZ/CAN'T INIT THE LPT
/]
	CALLI	12
INCONS:	OUTSTR	[ASCIZ/FREE STORAGE BLOCKS ARE INCONSISTIENT
/]
	CALLI	12
	END STRT